package service.imppl;

import dao.ISystemManagementDao;
import dao.impl.SystemManagementDao;
import pojo.Users;
import service.ISystemManagementService;

import java.util.ArrayList;

public class SystemManagementService implements ISystemManagementService {
    private ISystemManagementDao ismd=new SystemManagementDao();
    //系统管理
    //用户信息列表查看(动态模糊查询,初始状态为无条件全查)
    @Override
    public ArrayList<Users> queryUsers(Users users) {
        return ismd.selectUsers(users);
    }
    //用户添加(参数为用户对象)
    @Override
    public boolean addUser(Users users) {
        return ismd.insertUser(users)>0;
    }
    //当前用用户信息修改(根据用户ID修改)
    @Override
    public boolean changeUser(Integer uId) {
        ArrayList<Users> list=ismd.selectUser(uId);
        return ismd.updateUser(list.get(0))>0;
    }
    //用户详细信息查看(根据用户ID查看)
    @Override
    public Users queryUser(Integer uId) {
        return ismd.selectUser(uId).get(0);
    }
    //用户信息删除(根据用户ID删除)
    @Override
    public boolean removeUser(Integer uId) {
        return ismd.delUser(uId)>0;
    }
}
